<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>课室管理</title>
    <%@include file="../common/header.jsp"%>
    <script type="text/javascript">
        $(function (){
            $(".deleteBtn").click(function (){
                var name = $(this).parent().parent().find("td:first").text();
                return confirm("您确定要删除【"+ name +"】");
            });
        });
    </script>
</head>
<body>
	
	<div id="header">
			<img class="logo_img" alt="" src="static/img/logo.png" >
			<span class="wel_word">课室管理系统</span>
			<%@include file="../common/manager_menu.jsp"%>
	</div>
	
	<div id="main">
		<table>
			<tr>
				<td>课室名称</td>
				<td>容量</td>
				<td>多媒体情况</td>
				<td>类型</td>
				<td>状态</td>
				<td colspan="2">操作</td>
			</tr>

			<c:forEach items="${requestScope.page.items}" var="classroom">
			<tr>
				<td>${classroom.name}</td>
				<td>${classroom.capacity}</td>
				<td>
					<c:if test="${classroom.medium==0}">无</c:if>
					<c:if test="${classroom.medium==1}">有</c:if>
				</td>
				<td>
					<c:if test="${classroom.type==0}">普通教室</c:if>
					<c:if test="${classroom.type==1}">阶梯教室</c:if>
				</td>
				<td>
					<c:if test="${classroom.status==0}">空闲中</c:if>
					<c:if test="${classroom.status==1}">已借出</c:if>
					<c:if test="${classroom.status==2}">使用中</c:if>
				</td>
				<td><a href="manager/classroomServlet?action=findClassroom&id=${classroom.id}&pageNo=${requestScope.page.pageNo}">修改</a></td>
				<td><a class="deleteBtn" href="manager/classroomServlet?action=delete&id=${classroom.id}&pageNo=${requestScope.page.pageNo}">删除</a></td>
			</tr>
			</c:forEach>

			<tr>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td><a href="pages/manager/book_edit.jsp?pageNo="+${requestScope.page.pageTotal}>添加课室</a></td>
			</tr>	
		</table>
		<%@include file="../common/page_nav.jsp"%>
	</div>

	<%@include file="../common/footer.jsp"%>

</body>
</html>